#include<algorithm>
#include<iostream>
#include<ctime>
#include<vector>
using namespace std;
vector<int>num;
vector<int>arr;
void putData(const string& str){
    cout<<str;
    for(auto val:num)
        cout<<val<<" ";
    cout<<endl;
}
void getData(int n,int front,int rear){
    srand((unsigned)time(nullptr));
    for(int i=0;i<n;i++)
        num.push_back(rand()%(rear-front+1)+front);
}
bool st(int a,int b){
    return a%10>b%10;
}
int main(){
    getData(20,-10,10);
    putData("原始数据:");
    sort(num.begin(),num.end());
    putData("默认升序:");
    sort(num.begin(),num.end(),st);
    putData("规则排序:");
    auto air=find(num.begin(),num.end(),0);
    if(air!=num.end()){
        cout<<"下标:"<<distance(num.begin(),air)<<endl;
        replace(num.begin(),num.end(),0,2);
        putData("替换:");
        num.erase(remove(num.begin(),num.end(),2),num.end());
        putData("删除:");
        num.erase(remove_if(num.begin(),num.end(),[](int x){return x%5==0;}),num.end());
        putData("条件删除:");
    }else cout<<"没找到"<<endl;
    num.erase(unique(num.begin(),num.end()),num.end());
    putData("去重:");
    num.clear();
    return 0;
}